package com.magical.service.serviceImp;

import com.magical.controller.SharesController;
import com.magical.dao.SharesMapper;
import com.magical.entity.Shares;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.magical.service.SharesService;

import javax.annotation.Resource;
import java.util.List;


@Service
@Transactional
public class SharesServiceImpl implements SharesService{

    @Resource
    private SharesMapper sharesMapper;

    @Override
    public List<Shares> showAllShares(int userId) {
        List<Shares> list=sharesMapper.selectAllShares(userId);
        return list;
    }

    @Override
    public int delete(String shareId) {
        return sharesMapper.deleteByPrimaryKey(shareId);
    }

    @Override
    public Shares showShare(String id) {
        return sharesMapper.selectByPrimaryKey(id);
    }

    @Override
    public int addShare(Shares shares) {
        return sharesMapper.addShares(shares);
    }
}